<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	
	<link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
	<style type="text/css">
	.mui-table-view-cell {
    position: relative;
    overflow: hidden;
    padding: 15px 15px;
    -webkit-touch-callout: none;
	
	background-color: white;
}
.mui-table-view-cell>a:not(.mui-btn) {
    position: relative;
    display: block;
    overflow: hidden;
    margin: -11px -15px;
    padding: inherit;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: inherit;
	font-size: 15px;
	height: 50px;
}

.mui-table-view:before{
	height: 0;
}

.mui-table-view-cell:after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0px;
    height: 1px;
    content: '';
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
    background-color: #c8c7cc;
}

	</style>
</head>
<body style="background-color: white;">
	
<div class="mui-content" id="me-setter-listid" style="background-color: white;">
	<ul  class="mui-table-view" style="margin-top: 10px;">
			<!-- <li class="mui-table-view-cell">
				<a onclick = "tableDidSelected(0)" class="mui-navigate-right">
					编辑资料
				</a>
			</li> -->
			<li class="mui-table-view-cell">
				<a onclick = "tableDidSelected(1)" class="mui-navigate-right">
					 黑名单
				</a>
			</li>
			<li class="mui-table-view-cell">
				<a onclick = "tableDidSelected(2)" class="mui-navigate-right">
					 清空缓存 <span id="cache-size-id" style="float: right;margin-right: 40px; color: darkgray;font-size: 15px;">1.1M</span>
				</a>
			</li>
			<li class="mui-table-view-cell">
				<a onclick = "tableDidSelected(3)" class="mui-navigate-right">
					 意见反馈
				</a>
			</li>
			<li class="mui-table-view-cell">
				<a  onclick = "tableDidSelected(4)"  class="mui-navigate-right">
					 关于我们
				</a>
			</li>
			<!-- <li class="mui-table-view-cell">
				<a class="">
					 退出登录
				</a>
			</li> -->
		</ul>
		
		<div v-if = "islogin" id="logout-btn-id" style="margin-top: 50px;padding-left: 5px; padding-right: 5px;">
			<button type="button" style="padding-top: 10px;  width: 100%; height: 45px; color: white;font-size: 16px; border-width: 0; border-radius: 6px; background-color: #FF4500;" >退出登录</button>
		</div>
		
		<div style="position: fixed;bottom: 8px;text-align: center;width: 100%;font-size: 13px;color: #999;">
			©️2019郸城头条APP
		</div>
</div>

<script src="../../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/open.page.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/vue.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/user.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/hud.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	mui.init()
	
	var _v = new Vue({
		el:"#me-setter-listid",
		data:{
			islogin:userHasLogined()
		}
	})
	
	mui.plusReady(function () {
	    plus.cache.calculate(function(size){
			var _cache = mui('#cache-size-id')[0];
			_cache.innerText = parseFloat(size / (1024 * 1024)).toFixed(2) + "M";
		})
	})
	
	function tableDidSelected(row){
	if(row == 0 || row == 1 || row ==3){
			if(!userHasLogined()){
				hud_toast('请先登录');return;
			}
		}
		
	switch (row){
		//case 0:openNewPage('me-baseinfo.html' , '关于我们' , true);break;	
		case 1:openNewPage('me-black-list.html' , '黑名单' , true);break;
		case 2:
			 mui.confirm("确定清除缓存?", ["确认", "取消"], function(e) {
				 var userinfo = localStorage.getItem('loginuserinfo');
			    if(e.index == 0){
					hud_show('清除缓存');
			        plus.cache.clear(function() {
						var _cache = mui('#cache-size-id')[0];
						_cache.innerText = '0.00M';
						
						hud_close('清除完成');
						
						if(userinfo){
							localStorage.setItem('loginuserinfo' , userinfo);
						}
			        });
			    }
			});break;
		case 3://意见反馈
			openNewPage('../publish/pub-feedback.html' , '意见反馈' , true);break;
		case 4:openNewPage('me-setter-aboutus.html' , '关于我们' , true);break;	
		default:break;
		}
	}
	
	if(userHasLogined()){
		document.getElementById('logout-btn-id').addEventListener('tap',function(){
			plus.nativeUI.actionSheet({cancel:'取消' , buttons:[{title:'退出账号'}] }, function(e){
				if(e.index == 1){
					var wv = plus.webview.getWebviewById('www/me/me.html');
					localStorage.setItem('loginuserinfo' , '{}');
					
					mui.fire(wv , 'logout-event' , {});
					mui.back();
				}
				console.log(e.index);
			})
		})
	}

	
</script>
</body>
</html>